package com.asuka.eva.bo.impl;

import cn.hutool.json.JSONUtil;
import com.asuka.eva.bo.DemoAsyncTaskBO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author Jin zuo wei
 * @version 1.0.0
 * @description
 * @since 2021/12/26
 */
@Component
@Slf4j
public class DemoAsyncTaskBOImpl implements DemoAsyncTaskBO {

    public static void main(String[] args) {

        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);

    }

    @Override
    @Async("demoTaskExecutor")
    public void doAsyncTask(Map<String, List<String>> paramMap) {
        String requestStr = JSONUtil.toJsonStr(paramMap);
        log.info("异步任务参数打印：{}", requestStr);
        try {
//            String response = FastHttpClient.post().url(url).body(requestStr).build().execute().string();
//            log.info(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
